<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Document</title>
</head>
<body>
  <div id="app"></div>
  <script type="x-template" id="my-app">
    <div>
      <h2>{{title}}</h2>
      <h2>{{count}}</h2>
      <button @click="add">+1</button>
    </div>
  </script>


  <script src="https://unpkg.com/vue@3/dist/vue.global.js"></script>
  <script>
    Vue.createApp({
      template: '#my-app',
      data() {  // 数据源 是响应式的
        return {
          title: '你好世界',
          count: 1
        }
      },
      methods: {
        add() {
          this.count++
          // console.log('click to add');
        }
      }

    }).mount('#app')
  </script>


</body>
</html>